package com.mall.controller;


import com.baomidou.mybatisplus.extension.api.R;
import com.mall.service.FileUploadService;
import com.mall.util.Msg;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

@RestController
@RequestMapping("/file")
public class FileUploadController {
    @Autowired
    private FileUploadService fileUploadService;


    @PostMapping("/upload")
    public Msg fileUpload(MultipartFile file){
        String s = fileUploadService.uploadFile(file);
        return Msg.success("上传成功！").add("url",s);
    }
}
